<template>
  <div>
    <ul>
      <li v-for="i in list1" :key="i">{{i.company_name}}----{{i.name}}---{{i.rname}}
        <van-button @click="audit(i.id)">审核</van-button>
      </li>
    </ul>
    <van-dialog v-model:show="show" title="标题" show-cancel-button>
      <van-field label="描述信息" v-model="descipt" />
      <van-radio-group v-model="is_agree">
        <van-radio name="2">通过</van-radio>
        <van-radio name="3">未通过</van-radio>
      </van-radio-group>
      <van-button @click='submit'>提交</van-button>
    </van-dialog>
  </div>
</template>

<script>
import myaxios from 'axios'
export default {
name: "custom_list",
  data(){
    return{
      list1:{},
      show:false,
      descipt:'',
      is_agree:2,
      id:0,
    }
  },
  methods:{
    getlist(){
      myaxios({url:'http://127.0.0.1:8000/cust', method:'get'}).then(res=>{
        console.log(res.data)
        this.list1 = res.data.list
      })
    },
    audit(id){
      this.id=id
      this.show=true
    },
    submit(){
      myaxios({url:'http://127.0.0.1:8000/audit', method:'post', data:{'id':this.id,'descipt':this.descipt,'is_agree':this.is_agree}})
      .then(res=>{
        console.log(res.data)
      })
    }
  },
  mounted() {
    this.getlist()
  }
}
</script>

<style scoped>

</style>